import Vue from 'vue'
import Router from 'vue-router'
import axios from 'axios'
import VueAxios from 'vue-axios'
// import VueResource from 'vue-resource'
import Ebook from '@/Ebook'
import Bookcover from '@/Bookcover'
import Home from '@/Home'
import User from '@/User'
import Signup from '@/Signup'
import Login from '@/Login'
// import Storage from 'vue-ls'
import LabelList from '@/LabelList'
import Bookmenu from '@/Bookmenu'
import Search from '@/Search'
import Discussion from '@/Discussion'
import Message from '@/Message'
import Avatar from '@/Avatar'
import ModPwd from '@/ModPwd'
import Config from '@/Config'
import ModName from '@/ModName'
import Upload from '@/Upload'

Vue.use(Router)
Vue.use(VueAxios, axios)
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
// Vue.use(VueResource)
// 全局配置 axios 请求的根路径, 可以不写.
// axios.defaults.baseURL = 'http://127.0.0.1:8181'
// 把 axios 挂载到 Vue 原型上. 今后,在每个 .vue 组件中发起请求,直接调用 this.$http 即可.
// Vue.prototype.$http = axios
// vue-ls 的配置
// const storageOptions = {
//   namespace: 'vue_',
//   name: 'storage',
//   storage: 'local'
// }

// Vue.use(Storage, storageOptions)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/ebook',
      component: Ebook
    },
    {
      path: '/home',
      component: Home
    },
    {
      path: '/cover',
      component: Bookcover
    },
    {
      path: '/user',
      component: User
    },
    {
      path: '/sign',
      component: Signup
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/label',
      component: LabelList
    },
    {
      path: '/bookmenu',
      component: Bookmenu
    },
    {
      path: '/search',
      component: Search
    },
    {
      path: '/discussion',
      component: Discussion
    },
    {
      path: '/message',
      component: Message
    },
    {
      path: '/avatar',
      component: Avatar
    },
    {
      path: '/modpwd',
      component: ModPwd
    },
    {
      path: '/modname',
      component: ModName
    },
    {
      path: '/config',
      component: Config
    },
    {
      path: '/upload',
      component: Upload
    }
  ]
})
